/******************************************************************************
 * SAGE - Scalable Adaptive Graphics Environment
 *
 * Module: fsClient.h
 * Author : Byungil Jeong
 *
 * Copyright (C) 2004 Electronic Visualization Laboratory,
 * University of Illinois at Chicago
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either Version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser Public License along
 * with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 * Direct questions, comments etc about SAGE to bijeong@evl.uic.edu or 
 * http://www.evl.uic.edu/cavern/forum/
 *
 *****************************************************************************/
 
#ifndef _FSCLIENT_H
#define _FSCLIENT_H

#include "sage.h"
#include <QUANTA/QUANTA.hxx>


#define SOCK_BUF_SIZE (1024*1024*32)
#define READ_BUF_SIZE 4096
#define FS_ID 0 

class fsClient {
protected:
	QUANTAnet_tcpClient_c *client;
	char *fsIp;
	int portNum;

public:
   fsClient() {}
   ~fsClient(); 
	int init(char *config, char *portType);
	int init(int port);
	int connect(char *ip);
	int getSelfIP(char *ip);
	int sendMessage(sageMessage &msg);
	int sendMessage(int code);  
	int sendMessage(int code, int data);
	int sendMessage(int code, char *data); // string data 
	int sendMessage(int code, int size, void *data);
	int sendMessage(int dst, int code, int data);
	int sendMessage(int dst, int code, int app, char *data);
	int sendMessage(int dst, int code, int app, int size, void *data);
	int rcvMessage(sageMessage &msg);
	int rcvMessageBlk(sageMessage &msg);	
};


#endif
